% 最小二乘拟合多项式
clear;

x = [0; 0.25; 0.5; 0.75; 1];
y = [1; 1.284; 1.6487; 2.117; 2.7183];
C = [x.^0, x.^1, x.^2];
A = C' * C;
b = C' * y;

%a = inv(A)*b
a = A \ b;